Public Class RecordsFRM
    Public Alpha As Integer = 0
    Public Names As New List(Of String)
    Public Scores As New List(Of String)
    Public Index As Integer = 1
    Private Sub RecordsFRM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Names.Add(My.Settings.Name1)
        Names.Add(My.Settings.Name2)
        Names.Add(My.Settings.Name3)
        Names.Add(My.Settings.Name4)
        Names.Add(My.Settings.Name5)
        Scores.Add(My.Settings.Score1)
        Scores.Add(My.Settings.Score2)
        Scores.Add(My.Settings.Score3)
        Scores.Add(My.Settings.Score4)
        Scores.Add(My.Settings.Score5)

        Dim bmp As New Bitmap(Me.Width, Me.Height)
        Dim g As Graphics = Graphics.FromImage(bmp)
        Dim path As New Drawing2D.GraphicsPath
        path.AddRectangle(New Rectangle(0, 0, Me.Width, Me.Height))
        Dim b1 As New Drawing2D.PathGradientBrush(path)
        b1.CenterPoint = New Point(Me.Width / 2, Me.Height / 2)
        b1.CenterColor = Color.DarkGreen


        'b1.SurroundColors = New Color() {Color.Blue, Color.Green, Color.Red}
        'Dim blend As New Drawing2D.Blend
        'blend.Positions = New Single() {0.0, 0.5, 1.0}
        'b1.Blend = blend
        b1.SurroundColors = New Color() {Color.LightGreen}

        g.FillRectangle(b1, New Rectangle(0, 0, Me.Width, Me.Height))
        'bmp = ReflectionLib.CreateFade(bmp, 15)
        Me.BackgroundImage = bmp
    End Sub

    Private Sub Animation_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Animation.Tick
        Dim bmp As New Bitmap(pb1.Width - 40, pb1.Height - 40)
        Dim g As Graphics = Graphics.FromImage(bmp)
        If Index = 1 Then
            s1 = My.Settings.Name1
            s2 = My.Settings.Score1
        ElseIf Index = 2 Then
            s1 = My.Settings.Name2
            s2 = My.Settings.Score2
        ElseIf Index = 3 Then
            s1 = My.Settings.Name3
            s2 = My.Settings.Score3
        ElseIf Index = 4 Then
            s1 = My.Settings.Name4
            s2 = My.Settings.Score4
        ElseIf Index = 5 Then
            s1 = My.Settings.Name5
            s2 = My.Settings.Score5
        Else : s1 = ""
            s2 = ""
        End If
        s1 = Index & ". " & s1
        s2 = s2 / 100
        s2 = FormatPercent(s2, 3)
        Dim font As New Font(System.Drawing.FontFamily.GenericSerif, 25)

        Dim sz1 As SizeF = g.MeasureString(s1, font)
        Dim sz2 As SizeF = g.MeasureString(s2, font)

        Dim b1 As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, pb1.Width, pb1.Height), Color.Black, Color.White, Drawing2D.LinearGradientMode.ForwardDiagonal)
        Dim c1 As New Drawing2D.ColorBlend
        c1.Colors = New Color() {Color.Transparent, Color.Yellow, Color.Goldenrod, Color.Yellow, Color.Goldenrod, Color.Yellow, Color.DarkGoldenrod, Color.Transparent}
        c1.Positions = New Single() {0.0, 0.2, 0.3, 0.4, 0.5, 0.65, 0.8, 1.0}
        b1.InterpolationColors = c1
        If Alpha > 255 Then
            al = 255
        Else : al = Alpha
        End If
        Dim p As New Drawing2D.LinearGradientBrush(New Rectangle(0, 0, pb1.Width, pb1.Height), Color.FromArgb(Al, Color.Brown), Color.FromArgb(Al, Color.Brown), Drawing2D.LinearGradientMode.Horizontal)

        g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
        g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

        g.FillRectangle(b1, New Rectangle(0, 0, pb1.Width - 40, pb1.Height - 40))
        y1 = bmp.Height / 2 - ((sz1.Height + sz2.Height + 5) / 2)
        y2 = y1 + sz1.Height + 5
        g.DrawString(s1, font, p, bmp.Width / 2 - (sz1.Width / 2), y1)
        g.DrawString(s2, font, p, bmp.Width / 2 - (sz2.Width / 2), y2)
        Alpha = Alpha + 1
        If Alpha > 450 Then
            Alpha = 0
            Index = Index + 1
            If Index > 5 Then
                Index = 1
            End If
        End If
        'bmp = ReflectionLib.CreateFade(bmp, 15)
        Dim eff As New Effects
        'bmp = eff.ApplyBorder(bmp, 20, Color.Transparent, Color.Green, Effects.EdgeStyle.Round)
        bmp = eff.ApplyBorder(bmp, 20, Color.Snow, Color.Gold, Effects.EdgeStyle.Round)
        pb1.BackgroundImage = bmp
    End Sub

    Private Sub ExitButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitButton1.Click
        Form1.Show()
        Me.Close()
    End Sub

    Private Sub ExitButton1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton1.Load

    End Sub

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Dim res As MsgBoxResult = MsgBox("Are you sure that you want to erase ALL high score data?", MsgBoxStyle.YesNo, "Continue?")
        If res = MsgBoxResult.Yes Then
        Else : Exit Sub
        End If
        a = My.Settings.DictNum
        b = My.Settings.MaxWords
        c = My.Settings.MinWords
        My.Settings.Reset()
        My.Settings.DictNum = a
        My.Settings.MaxWords = b
        My.Settings.MinWords = c
        Names.Clear()
        Scores.Clear()
        Index = 1
        Alpha = 0

        Names.Add(My.Settings.Name1)
        Names.Add(My.Settings.Name2)
        Names.Add(My.Settings.Name3)
        Names.Add(My.Settings.Name4)
        Names.Add(My.Settings.Name5)
        Scores.Add(My.Settings.Score1)
        Scores.Add(My.Settings.Score2)
        Scores.Add(My.Settings.Score3)
        Scores.Add(My.Settings.Score4)
        Scores.Add(My.Settings.Score5)

    End Sub

    Private Sub FastForeward1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FastForeward1.Click
        Animation.Enabled = False
        Index = Index + 1
        If Index >= 6 Then
            Index = 1
        End If
        Alpha = 255
        Animation.Enabled = True
    End Sub
End Class